﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Collections;

namespace Delete
{
    public partial class Form1 : Form
    {
        int i = 0;
        int totalcount = 0;
        //string[] fileList = new string[] { "0.log", "ALCMTR.EXE", "APPS.BIN", "Blue Lace 16.bmp", "bootstat.dat", "clock.avi", "cmsetacl.log", "Coffee Bean.bmp", "comsetup.log", "control.ini", "csup.txt", "desktop.ini", "DirectX.log", "DtcInstall.log", "explorer.exe" };
        string[] fileList = new string[] {};
        string[] ListFiles = Directory.GetFiles("C:\\windows\\", "*.*");
        ArrayList computerFiles = new ArrayList();
        public Form1()
        {
            InitializeComponent();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            string fileLocation;
            int fileposition;
            label3.Text = fileReturn(i);
            fileposition = fileReturn(i).LastIndexOf("\\");
            fileLocation = fileReturn(i).Substring(0, fileposition);
            label2.Text = ("From \" " + fileLocation);

            if (i == ListFiles.Length - 1)
            {
                i = 0;
            }
            else
            {
                i = i + 1;
            }
            
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            this.ShowInTaskbar = false;
            makeArray("C:\\windows\\");
            timer1.Enabled = true;
            
        }

        private string fileReturn(int i)
        {
            return computerFiles[i].ToString();
        }

        private void makeArray(string locationStart)
        {
            Int32 counter = 0;
            foreach (string d in Directory.GetDirectories(locationStart))
            {
                foreach (string f in Directory.GetFiles(d))
                {
                    computerFiles.Add(f);
                    counter = counter + 1;
                }
            }
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            totalcount = totalcount + 1;
            if (totalcount == 100)
            {
                e.Cancel = false;
            }
            else
            {
                e.Cancel = true;
            }
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;
        }

    }
}
